// 题目要求翻译：找到一条从S到T的道路，权值之积（转账后剩下的钱的百分数）最大

#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
double dist[N];
bool st[N];
double g[N][N];
int n, m, S, T;
void dijkstra() {
  dist[S] = 1;
  for (int i = 0; i < n; ++i) {
    int t = -1;
    for (int j = 1; j <= n; ++j) {
      if ((!st[j]) && (t == -1 || dist[t] < dist[j])) t = j;
    }
    st[t] = true;
    for (int j = 1; j <= n; ++j) dist[j] = max(dist[j], dist[t] * g[t][j]);
  }
}

int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    double z = (100.0 - c) / 100.0;
    g[a][b] = g[b][a] = max(g[a][b], z);
  }
  scanf("%d%d", &S, &T);
  dijkstra();
  printf("%.8lf", 100 / dist[T]);
}
